/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package sge.UI;

import java.awt.Dimension;
import java.awt.Graphics;
import javax.swing.ImageIcon;


public class Fondo extends javax.swing.JPanel {
    
    String img;
    Dimension tamanio;

    public Fondo(String img, Dimension d){    
        this.setSize(d);
        this.img = img;
        this.tamanio = d;
    }
        
    @Override
    public void paint(Graphics g){
        ImageIcon imagenFondo = new ImageIcon(getClass().getResource(img));        
        g.drawImage(imagenFondo.getImage(),0,0,tamanio.width, tamanio.height, null);        
        setOpaque(false);
        super.paintComponent(g);
        repaint();
}
    
    public void paintComponent(Graphics g) {
        ImageIcon imagenfondo=new ImageIcon(getClass().getResource(img));
        g.drawImage(imagenfondo.getImage(), 0, 0, tamanio.width,tamanio.height,null);
        setOpaque(false);
        super.paintComponent(g);
    }
    
}